import http from '@/utils/request'

function getProListReq(count: number, limitNum: number) {
  return http({
    method: 'get',
    url: '/admin/pro/list',
    params: { count, limitNum },
  })
}
function patchProReq(proid: string, obj: object) {
  return http({
    method: 'patch',
    url: '/admin/pro/product/' + proid,
    data: obj,
  })
}
function uploadImgReq(formData: FormData) {
  return http({
    method: 'post',
    url: '/admin/file/upload',
    data: formData,
  })
}
function delProReq(proid: string) {
  return http({
    method: 'delete',
    url: '/admin/pro/product/' + proid,
  })
}
function addProReq(
  proname: string,
  originprice: string,
  desc: string,
  brand: string,
  category: string,
  imgs: string[],
 
) {
  return http({
    method: 'post',
    url: '/admin/pro/product',
    data: { proname, originprice, desc, brand, category, img1:imgs[0], img2:imgs[1], img3:imgs[2], img4:imgs[3]},
  })
}
export { getProListReq, patchProReq, uploadImgReq, delProReq, addProReq }
